fix(vscode): open plan files from review - #2329
Conversation
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 729e69ffe9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| <button | ||
| type="button" | ||
| onClick={() => { | ||
| void bridge.openPlanFile(); |
There was a problem hiding this comment.
Open the plan represented by the clicked review
When this button is used from a successfully completed tool card or loaded session history, openPlanFile() re-queries the session's active plan instead of opening block.path. Exiting plan mode clears the active plan, so the handler returns { ok: false }; if another plan has since started, it opens that newer plan despite displaying the old path. Bind the RPC to the reviewed plan through a trusted host-side identifier/path mapping so each card opens its own file.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in f6b7f45. Plan review cards now carry a host-issued opaque reference registered against the exact reviewed path. openPlanFile accepts only that reference, rejects unknown references, and no longer queries the session's active plan; the mapping is applied to both live events and replayed history. Added adapter, replay, and path-security regressions. The VS Code typecheck and production build pass.
Related Issue
Related to MoonshotAI/kimi-cli#2317, reported against the legacy repository.
Problem
The current VS Code extension receives the complete
plan_reviewbody, so the missing-text part of the legacy report is already addressed. The plan file path is still flattened away when the SDK display is adapted to the Webview, though, leaving no way to open the full plan from the review or the completed tool card.The generic file-open RPC intentionally rejects absolute and workspace-external paths, so using it for session plans under the Kimi home directory would either fail or require weakening an unrelated security boundary.
What changed
openPlanFileRPC. The extension host reads the path from the active SDK session withgetPlan(), verifies that the file exists, and opens that trusted path in VS Code.openFileRPC restricted to workspace-contained files.Validation
apps/vscodeextension and Webview TypeScript checksgit diff --checkChecklist
gen-changesets; no changeset applies becauseapps/vscodeis not a changeset-managed publishable package.